<template>
  <div class="work_control">
    <el-space wrap>
      <div
        class="control_item"
        v-for="i in controlList"
        @click="addControlWork(i.type)"
        :key="i.type"
      >
        <el-tooltip :content="i.type" :enterable="false" placement="right">
          <div>
            <span class="iconify" data-width="26" :data-icon="i.icon"></span>
          </div>
        </el-tooltip>
      </div>
    </el-space>
  </div>
</template>
<script setup lang="ts">
import { computed } from 'vue'

import { useCanvasStore } from '@/store/modules/canvasStore'
const canvasStore = useCanvasStore()

// 所有控件的列表
let controlList = computed(() => {
  return canvasStore.controlList
})

const addControlWork = (type: string) => {
  canvasStore.addPageComp(type)
}
</script>
<style lang="scss" scoped>
.work_control {
  box-sizing: border-box;
  padding: 10px;
  min-width: 300px;
  width: 300px;
  height: $mainHeight;
  background-color: #fff;
  box-shadow: 10px 0 10px -10px #c7c7c7;
  .control_item {
    width: 50px;
    height: 50px;
    background-color: #626aef;
    color: #fff;
    line-height: 60px;
    text-align: center;
    cursor: pointer;
  }
}
</style>
